package com.nothingboard.module.attach.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.nothingboard.module.attach.dao.AttachDao;
import com.nothingboard.module.attach.model.AttachSearchDto;
import com.nothingboard.module.attach.model.AttachVo;

public class AttachDaoImpl extends SqlMapClientDaoSupport implements AttachDao {
	
	@Resource(name="sqlMapClient")
	public void setSuperSqlMapClient(SqlMapClient sqlMapClient){
		super.setSqlMapClient(sqlMapClient);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Object> getAttachList(AttachSearchDto dto) throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("attach.getAttachList", dto);
	}

	@Override
	public Object setAttach(AttachVo vo) throws DataAccessException {
		return getSqlMapClientTemplate().insert("attach.setAttach", vo);
	}

	@Override
	public Object getAttach(long attachNo) throws DataAccessException {
		return getSqlMapClientTemplate().queryForObject("attach.getAttach", attachNo);
	}


}
